package com.bsfcs.rag.enums;

import org.springframework.util.StringUtils;

public enum JobCategory {
    DOC("1", "文档"),
    DEV("2", "开发"),
    COMMUNICATION("3", "客户沟通"),
    DEFAULT("", "");

    private final String code;
    private final String displayName;

    JobCategory(String code, String displayName) {
        this.code = code;
        this.displayName = displayName;
    }


    public String getCode() {
        return code;
    }

    public String getDisplayName() {
        return displayName;
    }

    public static JobCategory fromCode(String code) {
        if (!StringUtils.hasText(code)) {
            return null;
        }
        for (JobCategory category : JobCategory.values()) {
            if (category.getCode().equals(code)) {
                return category;
            }
        }
        return DEFAULT;
    }
}
